package com.mofang.ticketing.base.serve.file.service;

import com.mofang.ticketing.base.serve.file.pojo.response.AttachmentRespDTO;
import com.mofang.ticketing.base.serve.file.pojo.response.AttachmentUrlByIdsRespDTO;
import com.mofang.ticketing.common.core.enums.base.AttachmentDataTypeEnum;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
 * @author LGC
 * @date 2021/7/30 9:35
 * @copyright 2021 mofang. All rights reserved
 */
public interface IAttachmentManageService {

    /**
     * 上传文件保存到附件中
     *
     * @param file
     * @return
     */
    AttachmentRespDTO uploadAttachment(MultipartFile file);

    /**
     * 定时删除附件
     * 附件数据类型 = 0
     * or
     * 失效的附件
     */
    void delAttachment(Integer dayOffSet);

    /**
     * 保存附件
     *
     * @param attachmentUrls         附件url集合
     * @param relId                  关联ID
     * @param attachmentDataTypeEnum 附件数据类型枚举
     */
    void saveAttachment(List<String> attachmentUrls, Integer relId, AttachmentDataTypeEnum attachmentDataTypeEnum);

    /**
     * 附件失效
     *
     * @param attachmentDataTypeEnum 附件数据类型枚举
     * @param relId                  关联ID
     */
    void attachmentInvalid(AttachmentDataTypeEnum attachmentDataTypeEnum, Integer relId);

    /**
     * 附件批量失效
     * @param attachmentDataTypeEnum 附件数据类型枚举
     * @param relIdList 批量附件ID
     */
    void attachmentInvalid(AttachmentDataTypeEnum attachmentDataTypeEnum, List<Integer> relIdList);

    /**
     * 附件有效
     *
     * @param attachmentUrls         附件url集合
     * @param relId                  关联ID
     * @param attachmentDataTypeEnum 附件数据类型枚举
     */
    void attachmentValid(List<String> attachmentUrls, Integer relId, AttachmentDataTypeEnum attachmentDataTypeEnum);

    /**
     * 根据关联ID和附件数据类型
     * 获取附件URL集合
     *
     * @param relId                  关联ID
     * @param attachmentDataTypeEnum 附件数据类型枚举
     * @return
     */
    List<String> getAttachmentUrlList(Integer relId, AttachmentDataTypeEnum attachmentDataTypeEnum);

    /**
     * 根据关联ID集合和附件数据类型
     * 获取附件URL集合
     *
     * @param relIds                 关联ID集合
     * @param attachmentDataTypeEnum 附件数据类型枚举
     * @return
     */
    List<AttachmentUrlByIdsRespDTO> getAttachmentUrlList(List<Integer> relIds, AttachmentDataTypeEnum attachmentDataTypeEnum);

}